﻿<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>修改客户</title>
    <link rel="stylesheet" type="text/css" href="/easyui/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="/Style/main.css">
    <script type="text/javascript" src="/easyui/jquery.min.js"></script>
    <script type="text/javascript" src="/easyui/jquery.easyui.min.js"></script>
</head>
<body style="height:100%;">
    <form id="form1" class="easyui-form" action="/api/Member/Edit" method="post" data-options="novalidate:true">
        <input id="SupplierID" name="SupplierID" type="hidden" value="">
        <table class="tb60" border="0" cellpadding="0" cellspacing="0">
            <tr class="tr60">
                <td class="td80">客户简称：</td>
                <td colspan="3">
                    <input id="Name" name="Name" type="text" class="easyui-textbox in180"
                           data-options="required:true,validType:'length[2,30]',missingMessage:'必须填写',invalidMessage:'限于3-30个字之间',
                           validateOnCreate:false,validateOnBlur:true">
                    <span class="ft99"> 限于2至30个字之间</span>
                </td>
            </tr>
            <tr class="tr60">
                <td class="td80">正式名称：</td>
                <td colspan="3">
                    <input id="Company" name="Company" type="text" class="easyui-textbox in280">
                </td>
            </tr>
            <tr class="tr60">
                <td class="td80">拼音编码：</td>
                <td colspan="3">
                    <input id="Pinyin" name="Pinyin" type="text" class="easyui-textbox in180">
                    <span class="ft99"> 拼音简码或助记码</span>
                </td>
            </tr>
            <tr class="tr60">
                <td class="td80">联系地址：</td>
                <td colspan="3">
                    <input id="Address" name="Address" type="text" class="easyui-textbox in280">
                </td>
            </tr>
            <tr class="tr60">
                <td class="td80">类型：</td>
                <td class="td20">
                    <select id="Type" name="Type" class="easyui-combobox in120">
                        <option value="1" selected>供应商</option>
                        <option value="2">生产商</option>
                    </select>
                </td>
                <td class="td80">级别：</td>
                <td class="td20">
                    <select id="Rank" name="Rank" class="easyui-combobox in120">
                        <option value="1" selected>中级</option>
                        <option value="2">高级</option>
                        <option value="3">VIP</option>
                    </select>
                </td>
            </tr>
            <tr class="tr60">
                <td class="td80">联系人：</td>
                <td class="td20">
                    <input id="Contacts" name="Contacts" type="text" value="" class="easyui-textbox in120">
                </td>
                <td class="td80">职务：</td>
                <td class="td20">
                    <input id="Title" name="Title" type="text" value="" class="easyui-textbox in120">
                </td>
            </tr>
            <tr class="tr60">
                <td class="td80">电话：</td>
                <td class="td20">
                    <input id="TelPhone" name="TelPhone" type="text" value="" class="easyui-textbox in120">
                </td>
                <td class="td80">手机：</td>
                <td class="td20">
                    <input id="MobiPhone" name="MobiPhone" type="text" value="" class="easyui-textbox in120">
                </td>
            </tr>
            <tr class="tr60">
                <td class="td80">微信：</td>
                <td class="td20">
                    <input id="WeiXin" name="WeiXin" type="text" value="" class="easyui-textbox in120">
                </td>
                <td class="td80">QQ/Mail：</td>
                <td class="td20">
                    <input id="QQ" name="QQ" type="text" value="" class="easyui-textbox in120">
                </td>
            </tr>
            <tr class="tr60">
                <td class="td80">对公账户：</td>
                <td colspan="3">
                    <input id="BankNo" name="BankNo" type="text" class="easyui-textbox in180">
                </td>
            </tr>
            <tr class="tr60">
                <td class="td80">开户银行：</td>
                <td colspan="3">
                    <input id="BankName" name="BankName" type="text" class="easyui-textbox in280">
                </td>
            </tr>

            <tr class="tr60">
                <td class="td80">税号：</td>
                <td class="td20">
                    <input id="TaxID" name="TaxID" type="text" value="" class="easyui-textbox in120">
                </td>
                <td class="td80">类别：</td>
                <td class="td20">
                    <select id="TaxType" name="TaxType" class="easyui-combobox in120">
                        <option value="1" selected>小规模纳税人</option>
                        <option value="2">一般纳税人</option>
                        <option value="3">个体工商户</option>
                    </select>
                </td>
            </tr>
            <tr class="tr60">
                <td class="td80">说明：</td>
                <td colspan="3"><input id="Desc" name="Desc" type="text" multiline="true" class="easyui-textbox" style="width:420px;height:80px"></td>
            </tr>
            <tr class="tr60">
                <td class="td80">添加时间：</td>
                <td class="td20">
                    <input id="AddTime" name="AddTime" type="text" value="" class="easyui-textbox in120">
                </td>
                <td class="td80">最后修改：</td>
                <td class="td20">
                    <input id="LastTime" name="LastTime" type="text" value="" class="easyui-textbox in120">
                </td>
            </tr>
            <tr class="tr60">
                <td class="td80"></td>
                <td class="td20">
                    <a href="#" class="easyui-linkbutton btn" onclick="submitForm()" iconCls="icon-save" style="color: #009900;width:80px">保 存</a>
                </td>
                <td class="td80"></td>
                <td class="td20">
                    <a href="#" class="easyui-linkbutton btn" iconCls="icon-undo" style="color: #009900;width:80px">取 消</a>
                </td>
            </tr>
        </table>
    </form>
    <div id="divLoad" class="easyui-window" title="提示"
         data-options="modal:true,collapsible:false,minimizable:false,maximizable:false,closable:false"
         style="width:220px;height:80px;padding:10px;">
        正在获取信息，请稍候。。。
    </div>
    <script type="text/javascript" src="/Scripts/common.js"></script>
    <script type="text/javascript" src="/Scripts/pinyin_dict_firstletter.js"></script>
    <script type="text/javascript" src="/Scripts/pinyinUtil.js"></script>
    <script type="text/javascript">
        $(function () {
            getInfo();
            setPinYin();
        });

        function getInfo() {
            var sID = getQueryString();
            $("#SupplierID").val(sID.ID);
            var sUrl = "/api/Member/Get/" + sID.ID;
            $.ajax({
                url: sUrl,
                type: "get",
                dataType: "json",
                beforeSend: function () {
                    $('#divLoad').window('open');
                },
                success: function (data) {
                    var da = $.parseJSON(data);
                    $('#Name').textbox('setValue', da[0].Name);
                    $('#Pinyin').textbox('setValue', da[0].Pinyin);
                    $('#Company').textbox('setValue', da[0].Company);
                    $('#Address').textbox('setValue', da[0].Address);
                    $('#Type').combobox('setValue', da[0].Type);
                    $('#Rank').combobox('setValue', da[0].Rank);
                    $('#Contacts').textbox('setValue', da[0].Contacts);
                    $('#Title').textbox('setValue', da[0].Title);
                    $('#TelPhone').textbox('setValue', da[0].TelPhone);
                    $('#MobiPhone').textbox('setValue', da[0].MobiPhone);
                    $('#WeiXin').textbox('setValue', da[0].WeiXin);
                    $('#QQ').textbox('setValue', da[0].QQ);
                    $('#BankNo').textbox('setValue', da[0].BankNo);
                    $('#BankName').textbox('setValue', da[0].BankName);
                    $('#TaxID').textbox('setValue', da[0].TaxID);
                    $('#TaxType').combobox('setValue', da[0].TaxType);
                    $('#Desc').textbox('setValue', da[0].Desc);
                    $('#AddTime').textbox('setValue', da[0].AddTime);
                    $('#LastTime').textbox('setValue', da[0].LastTime);
                },
                error: function (msg) {
                    alert("很抱歉，未能获取相关信息，请稍候重试。或与技术人员联系。" + msg.statusText);
                },
                complete: function () {
                    $('#divLoad').window('close');
                }
            });
        }

        function submitForm() {
            $('#form1').form('submit', {
                onSubmit: function () {
                    return $(this).form('enableValidation').form('validate');
                },
                success: function (data, textStatus, x) {
                    if (data == 1) {
                        alert("客户信息修改成功。");
                        window.parent.closeThisTab();
                    }
                    else {
                        alert("很抱歉，遇到了一个技术问题，请稍后重试，或与技术人员联系。");
                    }
                },
                error: function (r, s, e) {
                    alert(r + s);
                }
            });
        }

    </script>
    <script type="text/javascript" src="/easyui/locale/easyui-lang-zh_CN.js"></script>
</body>
</html>
